package ma.myschool.app.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.search.annotations.Indexed;

@Entity
@Table(name = "annee_scolaire")
@Indexed
public class AnneeScolaire extends BaseObject {

	/**
	 * 
	 */
	private static final long serialVersionUID = -588402759776716051L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "annee_scolaire_id")
	private Long id;

	@Column(name = "date_creation")
	private Date dateCreation;
	
	@Column(name = "annee_scolaire")
	private String anneeScolaire;
	
	@Column(name = "frais_inscription")
	private float fraisInscription;

	
	public AnneeScolaire() {
		super();
	}

	public AnneeScolaire(Long id, Date dateCreation, String anneeScolaire,
			float fraisInscription) {
		super();
		this.id = id;
		this.dateCreation = dateCreation;
		this.anneeScolaire = anneeScolaire;
		this.fraisInscription = fraisInscription;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getDateCreation() {
		return dateCreation;
	}

	public void setDateCreation(Date dateCreation) {
		this.dateCreation = dateCreation;
	}

	public String getAnneeScolaire() {
		return anneeScolaire;
	}

	public void setAnneeScolaire(String anneeScolaire) {
		this.anneeScolaire = anneeScolaire;
	}

	public float getFraisInscription() {
		return fraisInscription;
	}

	public void setFraisInscription(float fraisInscription) {
		this.fraisInscription = fraisInscription;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((anneeScolaire == null) ? 0 : anneeScolaire.hashCode());
		result = prime * result
				+ ((dateCreation == null) ? 0 : dateCreation.hashCode());
		result = prime * result + Float.floatToIntBits(fraisInscription);
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AnneeScolaire other = (AnneeScolaire) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "AnneeScolaire [id=" + id + ", dateCreation=" + dateCreation
				+ ", anneeScolaire=" + anneeScolaire + ", fraisInscription="
				+ fraisInscription + "]";
	}
	
}
